module.service('Disburse', ['$rootScope', function ($rootScope) {
    var service = {
        _baseUrl: "/azeroth/back/tran/",

        currentDisburse: {},
        disburseList: [],
        totalSceneCount: 0,
        
        queryList: function (disburseNo, rechargeOrderNo, buyerMemberName, status, startDate, endDate, currentPage, pageSize, callback) {

            var paramData = {
            	disburseNo: disburseNo,
            	rechargeOrderNo: rechargeOrderNo,
            	buyerMemberName: buyerMemberName,
            	status: status,
            	startDate: startDate,
            	endDate: endDate,
            	pageNum: currentPage,
                start: (currentPage - 1) * pageSize,
                pageSize: pageSize,
            };
            
            $rootScope.ajaxRequestPost(service._baseUrl + "getDisburseList.htm", paramData, function (resultJson) {
            	currentProperty = paramData;
                angular.copy(resultJson.data, service.disburseList);
                service.totalSceneCount = resultJson.totalCount;
                if (callback) {
                    callback();
                }
            });

        },
        
        sendGoods: function (disburse, logisticsCompany, logisticsNo, callback) {
            var paramData = {
            		disburseNo: disburse.disburseNo,
            		logisticsCompany: logisticsCompany,
            		logisticsNo: logisticsNo
            		
            };
            
            $rootScope.ajaxRequestPost(service._baseUrl + "sendGoods.htm", paramData, function (resultJson) {
                if (callback) {
                    callback();
                }
                
            });
        }
        
    };
    return service;
}]);
